<template>
    <div class="app-container">
        <el-card>
            <div slot="header" class="clearfix">
                <span>客户请求</span>
            </div>
            <el-col :span="22" :offset="1" :xs="24">
                <el-descriptions title="" :column="3" :labelStyle="{ fontWeight: 'bold' }">
                    <el-descriptions-item label="请求名称">{{ form.custRequestName }}</el-descriptions-item>
                    <el-descriptions-item label="优先级">{{ form.priority }}</el-descriptions-item>
                    <el-descriptions-item label="状态">{{ statusIdFormat(form) }}</el-descriptions-item>
                    <el-descriptions-item label="描述" span="3">{{ form.description }}</el-descriptions-item>
                    <el-descriptions-item label="申请人"><span>{{ form.fromPartyId }}</span></el-descriptions-item>
                    <el-descriptions-item label="请求日期"><span>{{ form.custRequestDate
                    }}</span></el-descriptions-item>
                </el-descriptions>

            </el-col>
        </el-card>
    </div>
</template>
  
<script>
import { listCust_request, getCust_request, delCust_request, addCust_request, updateCust_request } from "@/api/ehr/cust_request";

export default {
    name: "Card_CustRequest",
    // props: {
    //     custRequestId: {
    //         type: String
    //     },
    // },
    data() {
        return {
            // 遮罩层
            loading: true,
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 状态业务字典
            statusIdOptions: [],
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 100,
                orderByColumn: "", // 排序字段
                isAsc: "", // 升序或降序 大写的 ASC或DESC,为空代表升序
                custRequestId: null,
                partyId: null,
                fromDate: null,
                thruDate: null,
            },
            // 表单参数
            form: {},
        };
    },
    created() {
        if (this.$route.query) {
            var custRequestId = this.$route.query.custRequestId;
            console.info("route query custRequestId:" + custRequestId)
            // this.custRequestId = custRequestId;
            this.getCustRequest(custRequestId);
        }

    },
    methods: {
        /** 查询列表 */
        getCustRequest(custRequestId) {
            this.reset();
            getCust_request(custRequestId).then(response => {
                this.form = response.data;
                this.open = true;
                this.title = "客户请求详情";
            });
        },
        statusIdFormat(row, column) {
            let val = null;
            this.statusIdOptions.forEach((item, index) => {
                if (row.statusId === item.enumCode) {
                    val = item.description;
                }
            });
            return val;
        },
        // 表单重置
        reset() {
            this.form = {
                custRequestId: null,
                custRequestTypeId: null,
                custRequestCategoryId: null,
                statusId: null,
                fromPartyId: null,
                priority: null,
                custRequestDate: null,
                responseRequiredDate: null,
                custRequestName: null,
                description: null,
                maximumAmountUomId: null,
                productStoreId: null,
                salesChannelEnumId: null,
                fulfillContactMechId: null,
                currencyUomId: null,
                openDateTime: null,
                closedDateTime: null,
                internalComment: null,
                reason: null,
                createdDate: null,
                createdByUserLogin: null,
                lastModifiedDate: null,
                lastModifiedByUserLogin: null,
                lastUpdatedStamp: null,
                lastUpdatedTxStamp: null,
                createdStamp: null,
                createdTxStamp: null
            };
            this.resetForm("form");
        },
    }
};
</script>
  